import java.util.*;

public class task2 {

	public static double getRadius(double volume, double height)throws IllegalArgumentException{

		if(volume <= 0 || height <=0)
			throw new IllegalArgumentException("Error: java.lang.IllegalArgumentException");
		else
		{
			double rad;

			rad = Math.sqrt((3*volume)/(Math.PI*height));

			return rad;	
		}
	}

	public static double getSurfaceArea(double rad,double height)throws IllegalArgumentException{
		
		if(rad <= 0 || height <=0)
			throw new IllegalArgumentException("Error: java.lang.IllegalArgumentException");
		else {
			double s = Math.sqrt(Math.pow(height,2)+Math.pow(rad,2));

			double sur = (Math.PI * rad * s) + (Math.PI * Math.pow(rad,2));

			return sur;
		}
		
	}
	
	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);

		try {
		System.out.print("Enter the volume [cm3] and height [cm] of a cone: ");
		double volume = sc.nextDouble();
		double height = sc.nextDouble();
		
		double rad = getRadius(volume,height);

		double sur = getSurfaceArea(rad,height);

		System.out.printf("Surface area = %.2f square cm",sur);
		}catch(IllegalArgumentException e) {
			System.err.print(e);
		}catch(InputMismatchException e) {
			System.out.print("Error: java.util.InputMismatchException");
		}

		sc.close();

	}

}
